package com.tongqin.distributed;

import com.alibaba.dubbo.common.extension.ExtensionLoader;
import com.alibaba.dubbo.rpc.Protocol;
import com.tongqin.distributed.api.IHello;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.net.UnknownHostException;

/**
 * Hello world!
 */
public class App {


    public static void main(String[] args) throws UnknownHostException {

       Integer a = new Integer(1);
//       a.equals()
        String s = new String();



        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("dubbo-client.xml");
        context.start();
        IHello hello = context.getBean("demoService",IHello.class);

        System.out.println(hello.sayHello("change"));

//        ServiceLoader.load()

//        Protocol myprotocol = ExtensionLoader.getExtensionLoader(Protocol.class).getExtension("myprotocol");

//        切入口
        Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension();

//        ExtensionLoader.getExtensionLoader(ExtensionFactory.class).getAdaptiveExtension();

        //        ExtensionLoader.getExtensionLoader(Protocol.class).getDefaultExtension().getDefaultPort();

//        String hostToBind = InetAddress.getLocalHost().getHostAddress();
//        System.out.println(hostToBind+"==");

    }
}
